﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" Title="Поръчки от клиенти"
    AutoEventWireup="true" CodeFile="ViewOrders.aspx.cs" Inherits="Orders_ViewOrders" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .ordertable
        {
            margin-right: 20px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h2 style="border-bottom: solid 1px black">
        <asp:Image ID="imgUsers" runat="server" Width="15" Height="15" ImageUrl="" />&nbsp;Поръчки
        от клиенти
    </h2>
    <div>
        <asp:GridView ID="gvOrderList" CssClass="ordertable" runat="server" AutoGenerateColumns="False"
            DataKeyNames="PurchaseOrderID" DataSourceID="ldsPurchaseOrders" CellPadding="4"
            ForeColor="#333333" GridLines="None" HorizontalAlign="Left" PageSize="14" OnSelectedIndexChanged="gvOrderList_SelectedIndexChanged">
            <RowStyle BackColor="#E3EAEB" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" CancelText="Отказ" DeleteText="Изтрий"
                    EditText="Редактирай" InsertText="Добави" NewText="Нов" SelectText="Избери" UpdateText="Обнови" />
                <asp:BoundField DataField="PurchaseOrderID" HeaderText="PurchaseOrderID" InsertVisible="False"
                    ReadOnly="True" SortExpression="PurchaseOrderID" Visible="False" />
                <asp:BoundField DataField="OrderNo" HeaderText="Номер" SortExpression="OrderNo" />
                <asp:BoundField DataField="OrderDate" HeaderText="Дата на доставка" SortExpression="OrderDate"
                    DataFormatString="{0:dd.MM.yyyy г.}" />
                <asp:BoundField DataField="AgreementNo" HeaderText="Съгласие №" SortExpression="AgreementNo" />
                <asp:BoundField DataField="OrderTotal" HeaderText="Обща сума" SortExpression="OrderTotal"
                    DataFormatString="{0:c}" />
            </Columns>
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#7C6F57" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:LinqDataSource ID="ldsPurchaseOrders" runat="server" ContextTypeName="Orders.OrdersDataClassesDataContext"
            EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="PurchaseOrders">
        </asp:LinqDataSource>
        <asp:DetailsView ID="dvOrderInfo" GridLines="Horizontal" runat="server" AutoGenerateRows="False"
            Height="50px" DataKeyNames="PurchaseOrderID" DataSourceID="ldsPurchaseOrderDetails"
            CellPadding="4" ForeColor="#333333" OnItemInserted="dvOrderInfo_ItemInserted"
            OnItemUpdated="dvOrderInfo_ItemUpdated" OnModeChanging="dvOrderInfo_ModeChanging">
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <FieldHeaderStyle Width="200px" BackColor="#DEE8F5" Font-Bold="True" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <Fields>
                <asp:TemplateField HeaderText="Номер" SortExpression="OrderNo">
                    <EditItemTemplate>
                        <asp:TextBox ID="tbOrderNumber" runat="server" Text='<%# Bind("OrderNo") %>'></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                            ID="rfvOrderNumber" Display="Static" ControlToValidate="tbOrderNumber" ToolTip="Моля въведете номер на заявката!"
                            runat="server">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbOrderNumber" runat="server" Text='<%# Bind("OrderNo") %>'></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                            ID="rfvOrderNumber" ControlToValidate="tbOrderNumber" ToolTip="Моля въведете номер на заявката!"
                            runat="server">*</asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("OrderNo") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Дата на поръчката" SortExpression="OrderDate">
                    <EditItemTemplate>
                        <asp:TextBox ID="tbOrderDate" runat="server" Text='<%# Bind("OrderDate", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:Button
                            ID="btnChooseOrderDate" runat="server" CausesValidation="false" Text="..." />&nbsp;<asp:RequiredFieldValidator
                                ID="rfvOrderDate" ControlToValidate="tbOrderDate" Display="Dynamic" ToolTip="Моля изберете дата на заявката!"
                                runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvOrderDate"
                                    runat="server" ControlToValidate="tbOrderDate" Type="Date" Display="Dynamic"
                                    Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!" ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator>
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarOrderDate" runat="server" TargetControlID="tbOrderDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseOrderDate" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbOrderDate" runat="server" Text='<%# Bind("OrderDate", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:Button
                            ID="btnChooseOrderDate" runat="server" CausesValidation="false" Text="..." />&nbsp;<asp:RequiredFieldValidator
                                ID="rfvOrderDate" ControlToValidate="tbOrderDate" Display="Dynamic" ToolTip="Моля изберете дата на заявката!"
                                runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvOrderDate"
                                    runat="server" ControlToValidate="tbOrderDate" Type="Date" Display="Dynamic"
                                    Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!" ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator>
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarOrderDate" runat="server" TargetControlID="tbOrderDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseOrderDate" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("OrderDate", "{0:dd.MM.yyyy г.}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Лице за контакт" SortExpression="ContactID">
                    <EditItemTemplate>
                        <telerik:RadComboBox ID="RadComboBoxContacts" runat="server" AllowCustomText="true"
                            EmptyMessage="Избери..." ChangeTextOnKeyBoardNavigation="true" DataSource='<%# ContactPersons %>'
                            DataTextField="ContactName" DataValueField="ContactPersonID" SelectedValue='<%# Bind("ContactId") %>'>
                            <CollapseAnimation Duration="200" Type="OutQuint" />
                        </telerik:RadComboBox>
                        <asp:RequiredFieldValidator ID="rfvContact" runat="server" ControlToValidate="RadComboBoxContacts"
                            ErrorMessage="Моля изберете лице за контакт!" ToolTip="Моля изберете лице за контакт!">
                        *</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <telerik:RadComboBox ID="RadComboBoxContacts" runat="server" AllowCustomText="true" 
                            EmptyMessage="Избери..." DataSource='<%# ContactPersons %>' DataTextField="ContactName"
                            DataValueField="ContactPersonID" SelectedValue='<%# Bind("ContactId") %>'>
                            <CollapseAnimation Duration="200" Type="OutQuint" />
                        </telerik:RadComboBox>
                        <asp:RequiredFieldValidator ID="rfvContact" runat="server" ControlToValidate="RadComboBoxContacts"
                            ErrorMessage="Моля изберете лице за контакт!" ToolTip="Моля изберете лице за контакт!">
                        *</asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# (string)Eval("ContactPerson.FirstName") + " " + (string)Eval("ContactPerson.LastName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Служител" SortExpression="EmployeeID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlEmployee" AppendDataBoundItems="true" runat="server" DataSource="<%# Employees %>"
                            DataTextField="EmployeeName" DataValueField="EmployeeId" SelectedValue='<%# Bind("EmployeeId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlEmployee" AppendDataBoundItems="true" runat="server" DataSource="<%# Employees %>"
                            DataTextField="EmployeeName" DataValueField="EmployeeId" SelectedValue='<%# Bind("EmployeeId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# (string)Eval("Employee.FirstName") + " " + (string)Eval("Employee.LastName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Условия на плащане" SortExpression="PaymentTermsID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlPaymentTerms" AppendDataBoundItems="true" CssClass="selectTest"
                            DataSource="<%# PaymentTerms %>" runat="server" DataTextField="NameBG" DataValueField="PaymentTermsId"
                            SelectedValue='<%# Bind("PaymentTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlPaymentTerms" AppendDataBoundItems="true" CssClass="selectTest"
                            DataSource="<%# PaymentTerms %>" runat="server" DataTextField="NameBG" DataValueField="PaymentTermsId"
                            SelectedValue='<%# Bind("PaymentTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Eval("PaymentTerm.NameBG") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Условия за доставка" SortExpression="DeliveryTermsId">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlDeliveryTerms" DataSource="<%# DeliveryTerms %>" runat="server"
                            DataTextField="NameBG" AppendDataBoundItems="true" DataValueField="DeliveryTermsId"
                            SelectedValue='<%# Bind("DeliveryTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlDeliveryTerms" AppendDataBoundItems="true" DataSource="<%# DeliveryTerms %>"
                            runat="server" DataTextField="NameBG" DataValueField="DeliveryTermsId" SelectedValue='<%# Bind("DeliveryTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("DeliveryTerm.NameBG") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Валута" SortExpression="CurrencyId">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlCurrency" AppendDataBoundItems="true" DataSource="<%# Currencies %>"
                            runat="server" DataTextField="NameBG" DataValueField="CurrencyId" SelectedValue='<%# Bind("CurrencyId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlCurrency" AppendDataBoundItems="true" DataSource="<%# Currencies %>"
                            runat="server" DataTextField="NameBG" DataValueField="CurrencyId" SelectedValue='<%# Bind("CurrencyId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("Currency.NameBG") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Съгласие №" SortExpression="AgreementNo">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("AgreementNo") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("AgreementNo") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label8" runat="server" Text='<%# Bind("AgreementNo") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Тип доставка" SortExpression="DeliveryMethodID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlDeliveryMethods" AppendDataBoundItems="true" DataSource="<%# DeliveryMethods %>"
                            runat="server" DataTextField="NameBG" DataValueField="DeliveryMethodId" SelectedValue='<%# Bind("DeliveryMethodID") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlDeliveryMethods" AppendDataBoundItems="true" DataSource="<%# DeliveryMethods %>"
                            runat="server" DataTextField="NameBG" DataValueField="DeliveryMethodId" SelectedValue='<%# Bind("DeliveryMethodID") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("DeliveryMethod.NameBG") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Условия за транспорт" SortExpression="FreightTermsID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlFreightTerms" AppendDataBoundItems="true" DataSource="<%# FreightTerms %>"
                            runat="server" DataTextField="NameBG" DataValueField="FreightTermsId" SelectedValue='<%# Bind("FreightTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlFreightTerms" AppendDataBoundItems="true" DataSource="<%# FreightTerms %>"
                            runat="server" DataTextField="NameBG" DataValueField="FreightTermsId" SelectedValue='<%# Bind("FreightTermsId") %>'>
                            <asp:ListItem Text="Избери..." Value=""></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("FreightTerm.NameBG") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Обща сума" SortExpression="OrderTotal">
                    <EditItemTemplate>
                        <asp:TextBox ID="tbOrderTotal" runat="server" Text='<%# Bind("OrderTotal") %>'></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                            ID="rfvOrderTotal" ControlToValidate="tbOrderTotal" Display="Dynamic" ToolTip="Моля изберете ощба сума!"
                            runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvOrderTotal"
                                runat="server" ControlToValidate="tbOrderTotal" Operator="DataTypeCheck" Display="Dynamic"
                                Type="Double" ToolTip="Моля въведете правилна сума!" ErrorMessage="Моля въведете правилна сума!">*</asp:CompareValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbOrderTotal" runat="server" Text='<%# Bind("OrderTotal") %>'></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                            ID="rfvOrderTotal" ControlToValidate="tbOrderTotal" Display="Dynamic" ToolTip="Моля изберете обща сума!"
                            runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvOrderTotal"
                                runat="server" ToolTip="Моля въведете правилна сума!" ControlToValidate="tbOrderTotal"
                                Operator="DataTypeCheck" Display="Dynamic" Type="Double" ErrorMessage="Моля въведете правилна сума">*</asp:CompareValidator>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label11" runat="server" Text='<%# Bind("OrderTotal", "{0:c}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Дата на доставка" SortExpression="DeliveryDate">
                    <EditItemTemplate>
                        <asp:TextBox ID="tbDeliveryDate" runat="server" Text='<%# Bind("DeliveryDate", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:Button
                            ID="btnChooseDeliveryDate" runat="server" CausesValidation="false" Text="..." />&nbsp;<asp:RequiredFieldValidator
                                ID="rfvDeliveryDate" Display="Dynamic" ControlToValidate="tbDeliveryDate" ToolTip="Моля изберете дата на доставката!"
                                runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvDeliveryDate"
                                    runat="server" ControlToValidate="tbDeliveryDate" Type="Date" Display="Dynamic"
                                    Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!" ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator>
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarDeliveryDate" runat="server" TargetControlID="tbDeliveryDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseDeliveryDate" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbDeliveryDate" runat="server" Text='<%# Bind("DeliveryDate", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:Button
                            ID="btnChooseDeliveryDate" runat="server" CausesValidation="false" Text="..." />&nbsp;<asp:RequiredFieldValidator
                                ID="rfvDeliveryDate" Display="Dynamic" ControlToValidate="tbDeliveryDate" ToolTip="Моля изберете дата на доставката!"
                                runat="server">*</asp:RequiredFieldValidator><asp:CompareValidator ID="cvDeliveryDate"
                                    runat="server" ControlToValidate="tbDeliveryDate" Type="Date" Display="Dynamic"
                                    Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!" ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator>
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarDeliveryDate" runat="server" TargetControlID="tbDeliveryDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseDeliveryDate" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label12" runat="server" Text='<%# Bind("DeliveryDate", "{0:dd.MM.yyyy г.}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Допълнителни бележки" SortExpression="Notes">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label13" runat="server" Text='<%# Bind("Notes") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Потвърдена поръчка" SortExpression="IsConfirmed">
                    <InsertItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsConfirmed") %>' />
                    </InsertItemTemplate>
                    <EditItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsConfirmed") %>' />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsConfirmed") %>'
                            Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Дата на потвърждаване" SortExpression="DateConfirmed">
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbConfirmDate" runat="server" Text='<%# Bind("ConfirmDate", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:CompareValidator
                            ID="cvConfirmDate" runat="server" ControlToValidate="tbConfirmDate" Type="Date"
                            Display="Dynamic" Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!"
                            ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator><asp:Button ID="btnChooseConfirmDate"
                                runat="server" CausesValidation="false" Text="..." />
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarConfirmDate" runat="server" TargetControlID="tbConfirmDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseConfirmDate" />
                    </InsertItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbConfirmDate" runat="server" Text='<%# Bind("DateConfirmed", "{0:dd.MM.yyyy г.}") %>'></asp:TextBox>&nbsp;<asp:CompareValidator
                            ID="cvConfirmDate" runat="server" ControlToValidate="tbConfirmDate" Type="Date"
                            Display="Dynamic" Operator="DataTypeCheck" ErrorMessage="Моля въведете валидна дата!"
                            ToolTip="Моля въведете валидна дата!">*</asp:CompareValidator><asp:Button ID="btnChooseConfirmDate"
                                runat="server" CausesValidation="false" Text="..." />
                        <ajaxToolkit:CalendarExtender ID="ajaxCalendarConfirmDate" runat="server" TargetControlID="tbConfirmDate"
                            Format="dd.MM.yyyy г." PopupButtonID="btnChooseConfirmDate" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label14" runat="server" Text='<%# Bind("DateConfirmed", "{0:dd.MM.yyyy г.}") %>'></asp:Label></ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" ShowInsertButton="True" ButtonType="Button"
                    CancelText="Отказ" DeleteText="Изтрий" EditText="Редактирай" InsertText="Добави"
                    NewText="Нов запис" SelectText="Избор" UpdateText="Обнови" />
            </Fields>
            <AlternatingRowStyle BackColor="White" />
        </asp:DetailsView>
        <asp:LinqDataSource ID="ldsPurchaseOrderDetails" runat="server" ContextTypeName="Orders.OrdersDataClassesDataContext"
            TableName="PurchaseOrders" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
            Where="PurchaseOrderID == @PurchaseOrderID" OnSelecting="ldsPurchaseOrderDetails_Selecting">
            <WhereParameters>
                <asp:ControlParameter ControlID="gvOrderList" Name="PurchaseOrderID" PropertyName="SelectedValue"
                    Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
        <div style="clear: both">
        </div>
        <br />
        <hr />
        <asp:Button ID="btnNewOrder" CausesValidation="false" runat="server" Text="Нова поръчка"
            OnClick="btnNewOrder_Click" />
        <asp:Button ID="btnViewProducts" Enabled="false" CausesValidation="false" runat="server"
            Text="Покажи продуктите" OnClick="btnViewProducts_Click" />
    </div>
</asp:Content>
